package nc.pub.zip;

import java.util.List;

import nc.bs.framework.common.NCLocator;
import nc.pub.zip.itf.IPubDMO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.SuperVO;

/**
 * @author zip
 * @date 26 May 2012 03:20:56
 * @type nc.pub.zip.PubDelegator
 */
public class PubDelegator {
	private static IPubDMO dmo = null;

	private PubDelegator() {
	}

	private static IPubDMO getDMO() {
		if (dmo == null) dmo = NCLocator.getInstance().lookup(IPubDMO.class);
		return dmo;
	}

	public static final Object getObject(String sql) throws Exception {
		return getDMO().getObject(sql);
	}

	public static final SuperVO getBean(String sql, Class<?> clazz) throws Exception {
		return getDMO().getBean(sql, clazz);
	}

	public static final List<?> getBeanList(String sql, Class<?> clazz) throws Exception {
		return getDMO().getBeanList(sql, clazz);
	}

	public static final List<?> getMapList(String sql) throws Exception {
		return getDMO().getMapList(sql);
	}

	public static final Object[] getArray(String sql) throws Exception {
		return getDMO().getArray(sql);
	}

	public static final AggregatedValueObject getBillVO(String[] billVONames, String parentPK) throws Exception {
		return getDMO().getBillVO(billVONames, parentPK);
	}

	public static final AggregatedValueObject[] getBillVOs(String[] billVONames, String where) throws Exception {
		return getDMO().getBillVOs(billVONames, where);
	}

	public static final String insert(SuperVO vo) throws Exception {
		return getDMO().insert(vo);
	}

	public static final String[] insert(List<?> voList) throws Exception {
		return getDMO().insert(voList);
	}

	public static final String[] insert(SuperVO[] vos) throws Exception {
		return getDMO().insert(vos);
	}

	public static final AggregatedValueObject insert(AggregatedValueObject billVO) throws Exception {
		return getDMO().insert(billVO);
	}

	public static final AggregatedValueObject[] insert(AggregatedValueObject[] billVOs) throws Exception {
		return getDMO().insert(billVOs);
	}

	public static final void delete(Class<?> clazz, String pk) throws Exception {
		getDMO().delete(clazz, pk);
	}

	public static final void delete(SuperVO vo) throws Exception {
		getDMO().delete(vo);
	}

	public static final void delete(SuperVO[] vos) throws Exception {
		getDMO().delete(vos);
	}

	public static final void delete(List<?> voList) throws Exception {
		getDMO().delete(voList);
	}

	public static final AggregatedValueObject delete(AggregatedValueObject billVO) throws Exception {
		return getDMO().delete(billVO);
	}

	public static final AggregatedValueObject[] delete(AggregatedValueObject[] billVOs) throws Exception {
		return getDMO().delete(billVOs);
	}

	public static final int update(SuperVO vo) throws Exception {
		return getDMO().update(vo);
	}

	public static final void update(SuperVO vo, String[] fields) throws Exception {
		getDMO().update(vo, fields);
	}

	public static final int update(SuperVO[] vos) throws Exception {
		return getDMO().update(vos);
	}

	public static final int update(SuperVO[] vos, String[] fields) throws Exception {
		return getDMO().update(vos, fields);
	}

	public static final void update(List<?> voList) throws Exception {
		getDMO().update(voList);
	}

	public static final int executeUpdate(String sql) throws Exception {
		return getDMO().executeUpdate(sql);
	}
}
